<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>家政管理系统-V6.8</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/branch_oa/css/font.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/branch_oa/css/xadmin.css">
        <script src="${pageContext.request.contextPath}/static/branch_oa/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/branch_oa/js/xadmin.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/branch_oa/js/jquery.min.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

        <![endif]-->
    </head>
    <body>

        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">
                                <input type="hidden" id="test1" value="" name=""/>
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="staffname"  placeholder="请输入员工姓名" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="card"  placeholder="请输入员工工号" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                              <thead>
                                <tr>
                                  <th>ID</th>
                                  <th>工号</th>
                                  <th>姓名</th>
                                  <th>性别</th>
                                  <th>操作</th>
                              </thead>
                              <tbody>
                              <c:forEach items="${staffListss.data}" var="staff" varStatus="abc">
                                <tr>
                                  <td>${abc.index+1}</td>
                                  <td>${staff.card}</td>
                                  <td>${staff.staffname}</td>
                                  <td>${staff.sex}</td>
                                  <td class="td-manage">
<%--                                    <a title="选择" href="javascript:;" class="layui-btn layui-btn layui-btn-xs" onclick="member_choice(this,'${staff.card}')">--%>
<%--                                      选择--%>
<%--                                    </a>--%>
                                     <input type="checkbox" name="duan" lay-filter="duan" value="${staff.card}" lay-skin="primary" >
                                  </td>
                                </tr>
                              </c:forEach>
                              </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                    <c:if test="${staffListss.pageNum > 1}">
                                        <a class="prev" href="${pageContext.request.contextPath}/sta/findStaffByBstoreidSettle?pageNum=${staffListss.pageNum-1}">&lt;&lt;</a>
                                    </c:if>
                                    <c:if test="${staffListss.pageNum == 1}">
                                        <a class="prev" href="">&lt;&lt;</a>
                                    </c:if>

                                    <c:forEach var="i" begin="${staffListss.start}" end="${staffListss.end}">
                                        <c:if test="${staffListss.pageNum == i}">
                                            <span class="current" href="${pageContext.request.contextPath}/sta/findStaffByBstoreidSettle?pageNum=${i}">${i}</span>
                                        </c:if>
                                        <c:if test="${staffListss.pageNum != i}">
                                            <a class="num" href="${pageContext.request.contextPath}/sta/findStaffByBstoreidSettle?pageNum=${i}">${i}</a>
                                        </c:if>
                                    </c:forEach>

                                    <c:if test="${staffListss.pageNum < staffListss.totalPage}">
                                        <a class="prev" href="${pageContext.request.contextPath}/sta/findStaffByBstoreidSettle?pageNum=${staffListss.pageNum+1}">>></a>
                                    </c:if>
                                    <c:if test="${staffListss.pageNum == staffListss.totalPage}">
                                        <a class="prev" href="">>></a>
                                    </c:if>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </body>
    <script>
      /*  function checkboxOnclick(checkbox){

            if ( checkbox.checked == true){

                alert("选中")

            }else{

                alert("未选中")
            }

        }*/

      layui.use(['laydate','form','jquery'], function(){
        var $ = layui.jquery;
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });

          form.render('checkbox');
          form.on('checkbox(duan)', function(data){
              var card = data.value;
              $.ajax({
                  type: 'POST',
                  url: "${pageContext.request.contextPath}/sta/getStaffCard",
                  data:card,
                  dataType:"json",
                  contentType:"application/json",
                  success: function (res) {
                            $("#test1").val(res.card);
                      console.log($("#test1").val());
                  }
              });

          });
          form.render('checkbox');

      });

      layui.use(['form', 'layer'],


      function() {
          $ = layui.jquery;
          var form = layui.form,
          layer = layui.layer;

      });

      /*用户-选择*/
      function member_choice(obj,card){

          layer.msg(card);
          <%--$.ajax({--%>
          <%--    type: 'POST',--%>
          <%--    url: "${pageContext.request.contextPath}/sta/getStaffCard",--%>
          <%--    data: card,--%>
          <%--    dataType:"json",--%>
          <%--    contentType:"application/json",--%>
          <%--    success: function (res) {--%>

          <%--              $("#test1").val(res.card);--%>
          <%--        console.log($("#test1").val());--%>
          <%--            // xadmin.close();--%>
          <%--            // xadmin.father_reload();--%>

          <%--    }--%>

          <%--});--%>


      }
      <%--function member_choice(obj,oId){--%>
      <%--    layer.confirm('确认要选择吗？',function(index){--%>
      <%--        //发异步删除数据--%>
      <%--        $.ajax({--%>
      <%--            type: 'post',--%>
      <%--            url: "${pageContext.request.contextPath}/sta/getStaffCard",--%>
      <%--            dataType:"json",--%>
      <%--            data: {"staffname":oId},--%>
      <%--            success: function (res) {--%>
      <%--                if(res){--%>
      <%--                    $(obj).parents("tr").remove();--%>
      <%--                    layer.msg('选择成功!',{icon:6,time:1000});--%>
      <%--                    xadmin.father_reload();--%>
      <%--                }else {--%>
      <%--                    layer.msg('选择失败!',{icon:5,time:1000});--%>
      <%--                    xadmin.father_reload();--%>
      <%--                }--%>
      <%--            }--%>
      <%--        });--%>
      <%--    });--%>
      <%--}--%>

      // function checkboxOnclick(checkbox){
      //
      //     if ( checkbox.checked == true){
      //
      //         alert("选中");
      //
      //     }else{
      //
      //         alert("不选中");
      //
      //     }
      //
      // }


    </script>
    <script type="text/javascript">
        $(function(){
            // $(".layui-icon").click(function () {
            //     // var data = tableCheck.getData();
            //     // console.log(data);
            //     if (this.checked==true){
            //
            //         alert("选中");
            //
            //     }else{
            //
            //         alert("不选中");
            //
            //     }
            // })
        });


    </script>
</html>